<%@ page language="java" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/jsp/pub/include.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>后台管理--<c:choose><c:when test="${empty clazzEntity}">发布题库</c:when><c:otherwise>编辑题库</c:otherwise></c:choose></title>
    <link href="<%=request.getContextPath() %>/css/admin.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function trim(str){
            return str.replace(/^\s+|\s+$/,"");
        }
        function check(form){
            if(form.courseId.value==0){
                alert("您还未选择题库");
                return false;
            }
            if(trim(form.name.value)==""){
                alert("标题不能为空");
                return false;
            }
            if(trim(form.courseId.value)==""){
                alert("您还未选择类型");
                return false;
            }

        <c:if test="${not empty clazzEntity}">
            form.action="<c:url value="/admin/addclazzLibrary?m=doedit"/>";
        </c:if>
            return true;
        }

    </script>
</head>
<body>
<div class="content">
    <jsp:include page="../pub/top.jsp"></jsp:include>
    <!--头部结束-->
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td class="left" valign="top">
                <jsp:include page="../pub/left_clazz.jsp"></jsp:include>
            </td>
            <td valign="top">
                <div class="right">
                    <form action="<c:url value="/admin/clazzLibraryadd?m=doadd"/>" method="post" onsubmit="return check(this)" enctype="multipart/form-data" style="margin:0">
                    <table width="80%" border="0" cellpadding="0" cellspacing="1" bgcolor="#d1d5d8">
                        <tr>
                            <td height="28" colspan="2" bgcolor="#c6dbf8" class="biaoti" style="padding:0;">
                                <c:choose>
                                    <c:when test="${empty clazzEntity}">添加题库</c:when>
                                    <c:otherwise>课程编辑</c:otherwise>
                                </c:choose>
                            </td>
                        </tr>
                        <tr>
                            <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>课程栏目：</td>
                            <td height="28" bgcolor="#FFFFFF">
                                <select class="sheng" name="courseId" id="courseId"">
                                <option value="0">选择课程栏目</option>
                                <c:forEach items="${courseList}" var="course">
                                    <option value="${course.id}" ${param.courseId==course.id?'selected=selected':''}><c:out value="${course.name}"/></option>
                                </c:forEach>
                                </select>

                                <p>选择课程</p>
                            </td>
                        </tr>
                        <tr>
                            <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>标题：</td>
                            <td height="28" bgcolor="#FFFFFF"><input type="text" name="name" id="name" size="60" value="${clazzEntity.name}" maxlength="25"/><p>请输入课程名称</p></td>
                        </tr>
                        <tr>
                            <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>试学数：</td>
                            <td height="28" bgcolor="#FFFFFF"><input type="number" name="trialNum" id="trialNum" min=5  min=20 value="<c:out value="${clazzEntity.trialNum}" default="10" />"/><p>请输入课程作者</p></td>
                        </tr>
                        <tr>
                            <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>题库类型：</td>
                            <td height="28" bgcolor="#FFFFFF">
                                <select class="sheng" name="libraryType" id="libraryType">
                                    <option value="0">选择题库类型</option>
                                    <c:forEach items="${libraryTypeList}" var="librType">
                                        <option value="${librType.name}" ${param.libraryType==librType.name?'selected=selected':''}><c:out value="${librType.value}"/></option>
                                    </c:forEach>
                                </select>

                                <p>题类型</p>
                            </td>
                        </tr>
                    </table>
                    <div class="anniu">
                        <p><input type="submit" value="提交" class="fabu" />
                            <c:choose>
                                <c:when test="${empty clazzEntity}"><input type="reset" value="重置" class="fabu" /></c:when>
                                <c:otherwise><input type="button" value="返回" class="fabu" onclick="history.back()" /></c:otherwise>
                            </c:choose>
                        </p>
                        <input type="hidden" name="id" value="${clazzEntity.id}"/>
                    </div>
                    </form>
                </div>
                <br />
                <br />
            </td>
        </tr>
    </table>
    <jsp:include page="../pub/foot.jsp"></jsp:include>
</div>
</body>
</html>
